package com.fredhat.tvshowrenamer;

public class TVShowEpisode {
	private int season;
	private int episode;
	private TVShow tvShow;
	private String title;

	public TVShowEpisode(int season, int episode, String title, TVShow tvShow) {
		this.season = season;
		this.episode = episode;
		this.tvShow = tvShow;
		this.title = title;
	}

	public int getSeason() {
		return season;
	}
	public int getEpisode() {
		return episode;
	}

	public TVShow getTvShow() {
		return tvShow;
	}

	public String getTitle() {
		return title;
	}

	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + episode;
		result = prime * result + season;
		result = prime * result + ((title == null) ? 0 : title.hashCode());
		result = prime * result + ((tvShow == null) ? 0 : tvShow.hashCode());
		return result;
	}

	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final TVShowEpisode other = (TVShowEpisode) obj;
		if (episode != other.episode)
			return false;
		if (season != other.season)
			return false;
		if (title == null) {
			if (other.title != null)
				return false;
		} else if (!title.equals(other.title))
			return false;
		if (tvShow == null) {
			if (other.tvShow != null)
				return false;
		} else if (!tvShow.equals(other.tvShow))
			return false;
		return true;
	}
	
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("[TVShowEpisode season=").append(season);
		sb.append(", episode=").append(episode);
		sb.append(", tvShow=").append(tvShow);
		sb.append(", title=").append(title);
		sb.append("]");
		return sb.toString();
	}
}
